//
// File:	Animation.hpp
// Author:	Thomas TISSOT-DUPONT
// E-mail:	<thomas.tissotdupont@free.fr>
// Create:	01/02/2010 21:17:37
// Purpose:	
//
#ifndef ANIMATION_HPP
#define ANIMATION_HPP

#include <vector>
#include <SFML/System.hpp>
#include <SFML/Graphics.hpp>
#include "IAnimation.hpp"
#include "Event.hpp"

class Animation : public IAnimation
{
public:
	//---TEMP---
	friend class Animating;
	//---

public:
											Animation(	const sf::Image *pImage,
														const std::string &animName,
														const sf::Vector2i &ivFrameSize,
														float flFrameRate = 8.0f,
														bool bFlipped = false,
														bool bLoop = false,
														int iRangeStart = -1,
														int iRangeEnd = -1);
											~Animation();

public:
	void									Play();
	void									Pause();
	void									Stop();
	void									Update();

public:
	const std::string						&GetName() const;
	void									SetFrameRate(float);
	void									SetLoop(bool);
	void									SetFlipped(bool);

public:
	bool									IsPlaying() const;
	const Frame								*GetCurrentFrame() const;

private:
	std::string								m_name;
	sf::Vector2i							m_ivFrameSize;
	float									m_flFrameRate;
	bool									m_bLoop;
	bool									m_bFlipped;
	bool									m_bPlaying;
	float									m_flCurrentFrame;
	std::vector<Frame>						m_framesVector;
	sf::Clock								m_clock;
};

#endif //!ANIMATION_HPP
